<!--变更业务受理启动modal-->
<template>
    <c-modal
            :width="width"
            :visible="visible"
            :title="title"
            :top="20"
            :bottom="20"
            @cancel="cancel"
            :key="key"
    >

        <Spin size="large" fix v-if="Loading"></Spin>
        <application ref="application" @finish="finish" v-show="updateForBG"/>
        <application2 ref="application2" @finish="finish" v-show="viewForTJ"/>
        <div slot="footer">
        </div>
    </c-modal>
</template>

<script>
    import application from './application';
    import application2 from './application_1012Update';
    import {postAction} from '@/api/request'

    export default {
        name: "application-modal",
        components: {
            application,
            application2
        },
        data() {
            return {
                tabName: "name1",
                handleNum: 99,
                scrollable: true,
                title: "动态变更救助对象",
                visible: false,
                disableSubmit: false,
                width: 800,
                height: 400,
                model: {},
                familyInfo: {},
                buttonList: [],
                key: "",
                Loading: false,
                changeType: 0,
                updateForBG: false,
                viewForTJ: false
            }
        },
        methods: {
            edit(record) {

                var ssca0002 = record.ssca0002;
                var ssca0012 = record.ssca0012;
                var name = "";
                if (ssca0002 == '100') {
                    if (ssca0012 == "200") {
                        name = "城市低保边缘家庭"
                    } else {
                        name = "城市最低生活保障"
                    }
                } else if (ssca0002 == '101') {
                    name = "城市单人保"
                } else if (ssca0002 == '102') {
                    name = "城市因病致贫保"
                } else if (ssca0002 == '200') {
                    if (ssca0012 == "200") {
                        name = "农村低保边缘家庭"
                    } else {
                        name = "农村最低生活保障"
                    }
                } else if (ssca0002 == '201') {
                    name = "农村单人保"
                } else if (ssca0002 == '202') {
                    name = "农村因病致贫保"
                } else if (ssca0002 == '203') {
                    name = "农村建档立卡保"
                }
                this.visible = true;
                this.familyInfo = record;
                var type = "";
                if (record.ssca0016 == '200') {
                    type = "动态变更";
                } else if (record.ssca0016 == '204') {
                    type = "调标变更";
                } else if (record.ssca0016 == '212') {
                    type = "转城市最低生活保障";
                } else if (record.ssca0016 == '213') {
                    type = "转城市单人保障";
                } else if (record.ssca0016 == '214') {
                    type = "转城市因病致贫保障";
                } else if (record.ssca0016 == '215') {
                    type = "转农村最低生活保障";
                } else if (record.ssca0016 == '216') {
                    type = "转农村单人保障";
                } else if (record.ssca0016 == '217') {
                    type = "转农村因病致贫保障";
                } else if (record.ssca0016 == '218') {
                    type = "转农村建档立卡保障";
                } else if (record.ssca0016 == '300') {
                    type = "停保";
                } else if (record.ssca0016 == '500') {
                    type = "区内迁移";
                } else if (record.ssca0016 == '501') {
                    type = "跨区迁移";
                }
                this.title = name + type;
                this.$nextTick(() => {
                    if (record.ssca0016 == '300' || record.ssca0016 == '500' || record.ssca0016 == '501'){
                        this.viewForTJ = true
                        this.updateForBG = false
                        this.$refs.application2.edit(record);
                    } else {
                        this.updateForBG = true
                        this.viewForTJ = false
                        this.$refs.application.edit(record);
                    }
                });
            },
            cancel() {
                this.visible = false;
            },
            finish() {
                this.$emit('ok');
                this.visible = false;
            }
        },
        created() {
            this.height = document.documentElement.clientHeight - 250;
        }
        ,
    }
</script>

<style scoped>
    #inforDiv {
        width: 100%;
        position: relative;
        margin-top: 20px;
        min-height: 200px;
    }

    #examinationButtonDiv {
        position: relative;
        margin-top: 20px;
        width: 100%;
        text-align: center;
    }

    .overflowContent {
        position: relative;
        width: 100%;
        overflow-y: auto;

    }

    /deep/ .ivu-modal-body {
        padding-top: 0px;
    }

    /deep/ .ivu-modal-footer {
        border-top: 0px;
        padding: 0px;
    }
</style>
